//
//  YKRefreshFooter.m
//  MagicBox
//
//  Created by wg on 16/9/7.
//  Copyright © 2016年 ZiLiFang_wenguang.hu. All rights reserved.
//

#import "YKRefreshFooter.h"

@interface YKRefreshFooter()


@end

@implementation YKRefreshFooter

- (void)prepare
{
    [super prepare];
    
    [self setTitle:@"上拉加载更多数据" forState:MJRefreshStateIdle];
    [self setTitle:@"松开立即刷新" forState:MJRefreshStatePulling];
    [self setTitle:@"正在加载数据..." forState:MJRefreshStateRefreshing];
    [self setTitle:@"-  End  -" forState:MJRefreshStateNoMoreData];
    
    self.stateLabel.font = [UIFont fontWithName:@"Helvetica" size:13.0f];
    self.stateLabel.textColor = [UIColor lightGrayColor];
    
    // 自动刷新
    self.automaticallyRefresh = YES;
    
    // 刷新控件出现一半就会进入刷新状态
    self.triggerAutomaticallyRefreshPercent = 0.5;
    
    
}

#pragma mark 监听控件的刷新状态
- (void)setState:(MJRefreshState)state
{
    MJRefreshCheckState;
    self.stateLabel.hidden = NO;
    switch (state) {
        case MJRefreshStateIdle:
            self.stateLabel.hidden = YES;
            break;
        case MJRefreshStateRefreshing:
            break;
        case MJRefreshStateNoMoreData:
            self.stateLabel.textColor = [UIColor lightGrayColor];
            self.stateLabel.font = [UIFont fontWithName:@"PingFangSC-Thin" size:13.0f];
            break;
        default:
            break;
    }
}
@end
